package com.jeff.rps.ui;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;

import com.jeff.rps.Game;

public class MainScreen extends JFrame
{
  private static final String TITLE = "RPS Battles!";
  private static final int WIDTH = 500;
  private static final int HEIGHT = 500;

  public MainScreen(Game game)
  {
    setTitle(TITLE);
    setSize(WIDTH, HEIGHT);

    addWindowListener(new WindowAdapter()
    {
      @Override
      public void windowDeactivated(WindowEvent e)
      {
        System.exit(0);
      }
    });

    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new IntroEventListener(game.getPlayer1(), game
        .getPlayer2()));

    getContentPane().add(canvas);
  }
}
